/* eslint-disable */
var Express = require('express');

var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackHotMiddleware = require('webpack-hot-middleware');
var webpackConfig = require('../webpack.config');

var app = new Express();
//为了不与发送页面的服务器的端口相冲突，我们将开发服务器的端口指定为3001。
var port = 3001;

var compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath }));
app.use(webpackHotMiddleware(compiler));

app.listen(port, (error) => {
    if (error) {
        console.error(error)
    } else {
        console.info(`==> 🚧  Webpack development server listening on port ${port}.`)
    }
});
